<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="/headfirst_js/debug/debug.js"></script>
<script>
	var debug;
	
	function text(elem){
		var txt="";
		elem  = elem.childNodes||elem;
		
		for(var i=0;i<elem.length;i++){
			txt += elem[i].nodeType !=1?elem[i].nodeValue:text(elem[i].childNodes);
		}
		return txt;
	}
	
	window.onload = function(e){
		debug =  new DebugConsole();
		
		var txt = text(document.body);
		debug.displayMsg("body:"+txt);
		debug.displayMsg("div:"+text(document.getElementsByTagName("div")[0].firstChild.nextSibling));
	}
</script>
</head>
<body>
	<p>first element</p>
	<div>second element
		<p>second elemtnt-firstchild</p>
	</div>
	<ul>
		<li>third element-1st child</li>
		<li>third element-2nd child</li>
		<li>third element-3th child</li>
		<li>third element-5th child</li>
		<li>third element-6th child</li>		
	</ul>
	
</body>
</html>